package jm.algorithm.recursion;

/**
 * @Description 递归调用展示
 * @date 2022/5/17 14:34
 */
public class ShowRecursion {
    public static void main(String[] args) {
        System.out.println(sum(10));
    }

    /**
     * 递归计算 0 ~ n 的和
     * @param n
     * @return
     */
    private static int sum(int n){
        if (n <= 1) return n;
        return n + sum(n - 1);
    }
}
